package com.mi.fastbird.mybstis.config;

import com.baomidou.mybatisplus.autoconfigure.ConfigurationCustomizer;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * MybatisPlus 配置
 *
 * @author 王永吉
 * @date 2020-01-14
 */
@Slf4j
@Configuration
public class MybatisConfig {

    /**
     * 分页
     */
    @Bean
    public PaginationInterceptor paginationInterceptor() {
        PaginationInterceptor page = new PaginationInterceptor();
        page.setDialectType("mysql");
        return page;
    }

    /**
     * 驼峰转换
     */
    @Bean
    public ConfigurationCustomizer configurationCustomizer() {
        return configuration -> configuration.setObjectWrapperFactory(new HumpHandler());
    }

    /**
     * 字段自动填充
     */
    @Bean
    public ColumnFillHandler columnFillHandler() {
        return new ColumnFillHandler();
    }


}



